package com.lxt.cloud.streammq.service.impl;

import com.lxt.cloud.streammq.channel.SendOutputChannel;
import com.lxt.cloud.streammq.service.IMessageProviderCustom;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;
import java.time.LocalTime;

@EnableBinding(SendOutputChannel.class)
public class MessageProviderCustomImpl implements IMessageProviderCustom {

    @Resource
    private SendOutputChannel sendOutputChannel;

    public void send() {
        LocalTime t = LocalTime.now();
        sendOutputChannel.msgSender().send(MessageBuilder.withPayload(t.toString()).build());
        System.out.println("*******time:"+t.toString());
    }
}
